package hu.szyrt.bug.overlays;

import hu.szyrt.bug.R;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class PlaceAnnotation extends LinearLayout{

	private LayoutParams params = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
	
	View root;
	ImageView icon;
	TextView title;
	TextView buttonDescription;
	Button button1, button2;
	
	// Construct ----------------------------------
	public PlaceAnnotation(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); init(); }
	public PlaceAnnotation(Context context, AttributeSet attrs) { super(context, attrs); init(); }
	public PlaceAnnotation(Context context) { super(context); init(); }
	private void init(){
		root = View.inflate(getContext(), R.layout.annotation_place, null);
		root.setLayoutParams(params);
		icon = (ImageView) root.findViewById(R.id.icon);
		title = (TextView) root.findViewById(R.id.title);
		buttonDescription = (TextView) root.findViewById(R.id.buttonDescription);
		button1 = (Button) root.findViewById(R.id.button1);
		button2 = (Button) root.findViewById(R.id.button2);
		addView(root, params);
	}
	
	public void focus(){
		this.requestFocus();
		this.title.requestFocus();
		this.title.requestFocusFromTouch();
	}
	
	// Setters -------------------------------------
	public void setTitle(CharSequence text) {
		title.setText(text);
	}
	
	public void setIcon(Drawable drawable) {
		icon.setImageDrawable(drawable);
	}
	
	public void setButtonDescription(CharSequence text) {
		buttonDescription.setText(text);
	}
	
	// Getters -------------------------------------
	public Button getButton1() {
		return button1;
	}
	
	public Button getButton2() {
		return button2;
	}
	
}
